using UnityEngine;
using System.Collections;

/// \class  gkTransformPhysicComponent
/// \brief  Physic component for actor controlled by cylindrical position
[AddComponentMenu("GK/Engine/Core/Physic/gkCylindricalPhysicController")]
[RequireComponent(typeof(gkCylindricalPosition))]
public class gkCylindricalPhysicController : gkPhysicController
{
	/// The cylindrical position
	private gkCylindricalPosition m_rCylindricalPosition;
	
	/// \brief  Called just before the first update
	void Start() 
	{
		// Get the cylindrical position component
		m_rCylindricalPosition = GetComponent<gkCylindricalPosition>();
	}
	
    /// \brief  Make the linear movement
    protected override void ProcessLinearMovement()
    {
	    // Movement
        m_rCylindricalPosition.position += GetLinearVelocity() * Time.deltaTime;
    }

    // \brief  Make the angular movement
    protected override void ProcessAngularMovement()
    {
	    // Movement
		transform.Rotate(GetAngularVelocity() * Time.deltaTime);
    }
}